BlockApi

interface BlockApi

Functions

Link copied to clipboard
abstract fun addComponentProperty(component: DesignBlock, name: String, target: DesignBlock, property: String)

Publishes a property of a block inside a main component under a name that instances can set.

Link copied to clipboard
abstract suspend fun addImageFileURIToSourceSet(block: DesignBlock, property: String, uri: String)

Add a source to the sourceSet property of the given block. If there already exists in source set an image with the same width, that existing image will be replaced. If the source set is or gets empty, the crop and content fill mode of the associated block will be set to the default values. Note: This fetches the resource from the given URI to obtain the image dimensions. It is recommended to use setSourceSet if the dimension is known.

Link copied to clipboard
abstract suspend fun addImageFileUriToSourceSet(block: DesignBlock, property: String, uri: String)

Add a source to the sourceSet property of the given block. If there already exists in source set an image with the same width, that existing image will be replaced. If the source set is or gets empty, the crop and content fill mode of the associated block will be set to the default values. Note: This fetches the resource from the given URI to obtain the image dimensions. It is recommended to use setSourceSet if the dimension is known.

Link copied to clipboard
abstract suspend fun addVideoFileUriToSourceSet(block: DesignBlock, property: String, uri: String)

Add a source to the sourceSet property of the given block. If there already exists in source set a video with the same width, that existing video will be replaced. If the source set is or gets empty, the crop and content fill mode of the associated block will be set to the default values. Note: This fetches the resource from the given URI to obtain the video dimensions. It is recommended to use setSourceSet if the dimension is known.

Link copied to clipboard
abstract fun adjustCropToFillFrame(block: DesignBlock, minScaleRatio: Float)

Adjust the crop position/scale to at least fill the crop frame. On a page with a bleed, the content also covers the bleed, and the ratio includes the bleed. This needs the setting page/imageFillCoversBleed, which is on by default. Required scope: "layer/crop"

Link copied to clipboard
abstract fun alignHorizontally(blocks: List<DesignBlock>, alignment: HorizontalBlockAlignment)

Align multiple blocks vertically within their bounding box or a single block to its parent. Required scope: "layer/move"

Link copied to clipboard
abstract fun alignVertically(blocks: List<DesignBlock>, alignment: VerticalBlockAlignment)

Align multiple blocks vertically within their bounding box or a single block to its parent. Required scope: "layer/move"

Link copied to clipboard
abstract fun appendChild(parent: DesignBlock, child: DesignBlock)

Appends a new or existing child to a block's children. A move fails when it would put a block with a matte inside its matte source, or on another page than its source. A page slice takes no children, and it can only be a child of a page with a rect shape. A video scene takes no page slice. A page slice that a block load or duplicate returns holds the blocks that it was saved with. The next update moves them onto the page, into the new place of the page slice. Required scope: "editor/add"

Link copied to clipboard
abstract fun appendEffect(block: DesignBlock, effectBlock: DesignBlock)

Inserts an effect at the end of the list of effects. The same effect can appear multiple times in the list and won't be removed if appended again. Required scope: "appearance/effect"

Link copied to clipboard
abstract fun appendMask(block: DesignBlock, maskBlock: DesignBlock)

Inserts a mask at the end of the masks of the block. A mask can be used by more than one block. Required scope: "layer/clipping"

Link copied to clipboard
abstract fun appendModifier(block: DesignBlock, modifierBlock: DesignBlock)

Appends a modifier to the modifiers of a shape. The same modifier can appear multiple times in the list. Required scope: "shape/change" on every block that uses the shape.

Link copied to clipboard
abstract fun appendSubshape(block: DesignBlock, subshapeBlock: DesignBlock)

Appends a subshape to a compound shape. A shape has one owner, so the subshape is detached from its previous block or compound shape. Line shapes cannot be subshapes. The call fails when the shape tree would nest more than 128 shapes. Required scope: "shape/change"

Link copied to clipboard
abstract fun appendTextAnimator(block: DesignBlock, animatorBlock: DesignBlock)

Appends a text animator to the text animators of a block. A text animator belongs to one block at a time. Required scope: "appearance/animation"

Link copied to clipboard
abstract fun bringForward(block: DesignBlock)

Updates the sorting order of this block and all of its superjacent siblings so that the given block has a higher sorting order than the next superjacent sibling. If the block is parented to a track, it is first moved up in the hierarchy. Empty tracks and empty groups are passed by.

Link copied to clipboard
abstract fun bringToFront(block: DesignBlock)

Updates the sorting order of this block and all of its manually created siblings so that the given block has the highest sorting order. If the block is parented to a track, it is first moved up in the hierarchy.

Link copied to clipboard

Query if the given block can be reverted to the intrinsic aspect ratio of its image/video content. Backs the "Original" crop preset (AssetTransformPreset.ContentAspectRatio).

Link copied to clipboard
abstract fun canToggleBoldFont(block: DesignBlock, from: Int = -1, to: Int = -1): Boolean

Returns whether the font weight of the given block can be toggled between bold and normal.

Link copied to clipboard
abstract fun canToggleItalicFont(block: DesignBlock, from: Int = -1, to: Int = -1): Boolean

Returns whether the font style of the given block can be toggled between italic and normal.

Link copied to clipboard
abstract fun combine(blocks: List<DesignBlock>, op: BooleanOperation): DesignBlock

Perform a boolean operation on the given blocks.

Link copied to clipboard
abstract fun combineAsVariants(components: List<DesignBlock>): DesignBlock

Moves main components into a new container as variants of one component.

Link copied to clipboard
abstract fun convertToComponent(block: DesignBlock)

Makes a block a main component, so that instances can follow it.

Link copied to clipboard
abstract fun create(blockType: String): DesignBlock
abstract fun create(blockType: DesignBlockType): DesignBlock

Create a new block.

Link copied to clipboard

Creates a new animation, fails if type is unknown.

Link copied to clipboard
abstract fun createAudioFromVideo(videoFill: DesignBlock, trackIndex: Int, options: AudioFromVideoOptions = AudioFromVideoOptions()): DesignBlock

Create a new audio block by extracting a specific audio track from a video fill block.

Link copied to clipboard
abstract fun createAudiosFromVideo(videoFill: DesignBlock, options: AudioFromVideoOptions = AudioFromVideoOptions()): List<DesignBlock>

Create multiple audio blocks by extracting all audio tracks from a video fill block.

Link copied to clipboard
abstract fun createBlur(type: String): DesignBlock
abstract fun createBlur(type: BlurType): DesignBlock

Create a new blur, fails if type is unknown or not a valid blur type.

Link copied to clipboard
abstract suspend fun createCaptionsFromURI(uri: String): List<DesignBlock>

Creates new caption blocks from the given file.

Link copied to clipboard
abstract fun createCutoutFromBlocks(blocks: List<DesignBlock>, vectorizeDistanceThreshold: Float = 2.0f, simplifyDistanceThreshold: Float = 4.0f, useExistingShapeInformation: Boolean = true): DesignBlock

Create a cutout block whose path will be the contour of the given blocks. The cutout path for each block is derived from one of the two ways:

Link copied to clipboard

Perform a boolean operation on the given Cutout blocks. The cutout offset of the new block is 0. The cutout type of the new block is that of the first block. When performing a CutoutOperation.DIFFERENCE operation, the first block is the block subtracted from.

Link copied to clipboard

Create a Cutout block.

Link copied to clipboard
abstract fun createEffect(type: String): DesignBlock
abstract fun createEffect(type: EffectType): DesignBlock

Create a new effect block, fails if type is unknown or not a valid effect block type.

Link copied to clipboard
abstract fun createFill(fillType: String): DesignBlock
abstract fun createFill(fillType: FillType): DesignBlock

Create a new fill, fails if type is unknown.

Link copied to clipboard
abstract fun createFromSVG(svg: String): DesignBlock

Create editable graphic blocks from SVG markup, such as the SVG code that Adobe Illustrator copies. Each shape of the SVG becomes a graphic block with a vector path shape, its fill color or gradient, and its stroke. More than one block goes into a group. Embedded images, text, filters, masks and patterns have no shape. Each such part becomes a graphic block with an image fill of only that part. The blocks are not attached to a parent. An SVG user unit is a pixel in a scene measured in pixels. In a scene measured in millimeters or inches it is a point, as Adobe Illustrator writes it.

Link copied to clipboard
abstract fun createInstance(component: DesignBlock): DesignBlock

Creates an instance of a main component. Attach it with appendChild. An instance follows every property that it does not override. Its children cannot be added, reordered or destroyed. Hide a child with setVisible.

Link copied to clipboard
abstract fun createMask(): DesignBlock

Create a new mask block. A mask cuts its block down to the area of the mask's shape. Give the mask a shape with setShape; a mask without a shape has no effect. The shape is evaluated in the frame of the block that the mask is attached to. The mask properties are mask/mode, mask/opacity, mask/feather, mask/expansion and mask/inverted.

Link copied to clipboard

Create a new shape modifier block, fails if type is unknown or not a valid modifier block type. A modifier changes the path of a shape, or draws the shape several times.

Link copied to clipboard
abstract fun createShape(type: String): DesignBlock
abstract fun createShape(type: ShapeType): DesignBlock

Create a new shape, fails if type is unknown.

Link copied to clipboard

Create a new text animator block. A text animator changes the glyphs of a text block that its range selector covers: their position, scale, rotation, skew, opacity, colors, stroke width, tracking and blur. Every property of a text animator can have keyframes.

Link copied to clipboard

Creates a new transition, fails if type is unknown. Its transition/overlap value is initialized from the current clip/defaultTransitionOverlapEnabled editor setting.

Link copied to clipboard
abstract fun destroy(block: DesignBlock)

Destroys a block. A page slice destroys the blocks that it owns on its page, without a check of their scopes, as a page destroys its children. This holds for the last page slice too: its page becomes an empty page without page slices, at the same size. To keep the content, move the page slice out with movePageSliceOutOfPage first. Destroying a page slice runs an internal update. Required scope: "lifecycle/destroy"

Link copied to clipboard
abstract fun detachInstance(instance: DesignBlock)

Turns an instance into plain blocks that no longer follow the main component.

Link copied to clipboard
abstract fun distributeHorizontally(blocks: List<DesignBlock>)

Distribute multiple blocks vertically within their bounding box so that the space between them is even. Required scope: "layer/move"

Link copied to clipboard
abstract fun distributeVertically(blocks: List<DesignBlock>)

Distribute multiple blocks vertically within their bounding box so that the space between them is even. Required scope: "layer/move"

Link copied to clipboard
abstract fun duplicate(block: DesignBlock, attachToParent: Boolean = true): DesignBlock

Duplicates a block including its children. Copies the current duration, even if initialization is pending on the original. The duplicate does not resume initialization. A scene cannot be duplicated, and the call throws for it. Required scope: "lifecycle/duplicate" If the block is parented to a track that is set always-on-bottom, the duplicate is inserted in the same track immediately after the block. Otherwise, the duplicate is moved up in the hierarchy. The duplicate of a page slice takes a copy of the blocks that the page slice owns on its page. The call runs an internal update for a page slice on a page, also while features/implicitUpdatesEnabled is off. A block that a page slice owns gets its Percent position and size in design units in the copy. The copy does not follow the size of its page.

Link copied to clipboard
abstract fun enterGroup(block: DesignBlock)

Changes selection from selected group to a block within that group. Nothing happens if block is not a group. Required scope: "editor/select"

Link copied to clipboard
abstract fun exitGroup(block: DesignBlock)

Changes selection from a group's selected block to that group. Nothing happens if block is not a group. Required scope: "editor/select"

Link copied to clipboard
abstract fun export(block: DesignBlock, options: ExportOptions? = null, progressCallback: (ExportPdfProgress) -> Unit? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): Flow<ByteBuffer>

Exports a design block element as a PDF and emits the bytes as chunks while they are produced, so the document is never held in memory as a whole. This is the same export as the export overload that takes an OutputStream. Prefer that overload when the destination is a file, a content:// target or an upload stream, and this one when the chunks feed a coroutine pipeline. Performs an internal update to resolve the final layout for the blocks. Note: The returned flow is cold. Each collection runs one export, which starts when the collection starts, and the flow completes after the last chunk. Collect it on the engine thread, like every other engine call. Note: The flow has no buffer. The encoder waits until the collector has taken a chunk, so a slow collector slows the encoder down and the chunks do not queue up in memory. A collector that keeps the chunks, for example with toList(), holds the whole document in memory again. Note: When the collector leaves or its coroutine is cancelled, the export stops. Note: This overload has no mimeType parameter and always exports a PDF. The export overload that takes an OutputStream also streams raster formats. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the collection ends. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

abstract suspend fun export(block: DesignBlock, mimeType: MimeType, options: ExportOptions? = null, progressCallback: (ExportPdfProgress) -> Unit? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): ByteBuffer

Exports a design block element as a file of the given mime type. The export of a page slice gives the part of its page inside the page slice, with the bleed of the page on all four sides. At a fold, that bleed shows the content of the page slice beside it. The export of a hidden page slice shows it and its content. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

abstract suspend fun export(blocks: List<DesignBlock>, mimeType: MimeType, options: ExportOptions? = null, progressCallback: (ExportPdfProgress) -> Unit? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): List<ByteBuffer>

Exports multiple design block elements as files of the given mime type. Performs an internal update to resolve the final layout for the blocks. This method is more memory efficient than calling export repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

abstract suspend fun export(block: DesignBlock, output: OutputStream, mimeType: MimeType = MimeType.PDF, options: ExportOptions? = null, progressCallback: (ExportPdfProgress) -> Unit? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null)

Exports a design block element as a PDF and writes the bytes into output while they are produced, so the document is never held in memory as a whole. Prefer this over the export that returns a ByteBuffer for large multi-page documents such as photo books and magazines: the peak memory is the working set of one page, whatever the number of pages. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver). Note: output is written from that background thread with one write for each chunk, so a slow destination slows the encoder down and the chunks do not queue up in memory. ExportOptions.pdfChunkSize bounds the size of a chunk. The caller keeps the ownership of output and closes it, for example with use. Note: When the export fails or the calling coroutine is cancelled, the export stops and output holds an incomplete document. A write that blocks delays the cancellation until it returns.

Link copied to clipboard
abstract suspend fun exportAudio(block: DesignBlock, mimeType: MimeType = MimeType.AUDIO_WAV, options: ExportAudioOptions? = null, progressCallback: (ExportAudioProgress) -> Unit? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): ByteBuffer

Exports the audio of a design block as an audio file of the given mime type. A page mixes the audio of all its blocks, a track mixes its children, and an audio block or a block with a video fill exports its own audio. A scene exports its first page. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

abstract suspend fun exportAudio(blocks: List<DesignBlock>, mimeType: MimeType = MimeType.AUDIO_WAV, options: ExportAudioOptions? = null, progressCallback: (ExportAudioProgress) -> Unit? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): List<ByteBuffer>

Exports the audio of multiple design blocks as audio files of the given mime type, one after the other, with one background engine. Otherwise it works like the exportAudio overload for one block.

Link copied to clipboard
abstract suspend fun exportPreview(block: DesignBlock): ByteBuffer

Exports a small image of a block to show in your app. A preview does not count as an export.

Link copied to clipboard
abstract suspend fun exportVideo(block: DesignBlock, mimeType: MimeType = MimeType.MP4, options: ExportVideoOptions? = null, progressCallback: (ExportVideoProgress) -> Unit? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): ByteBuffer
abstract suspend fun exportVideo(block: DesignBlock, timeOffset: Double, duration: Double, mimeType: MimeType, progressCallback: (ExportVideoProgress) -> Unit, options: ExportVideoOptions? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): ByteBuffer

Exports a design block as a video file of the given mime type. Note: MP4 exports embed a PNG cover at the page cover time when playback/coverTimeEnabled is true, else at the page playback position. coverTimeOffset overrides both. An MP4 export of a scene uses its first frame as the cover. Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

abstract suspend fun exportVideo(blocks: List<DesignBlock>, mimeType: MimeType = MimeType.MP4, options: ExportVideoOptions? = null, progressCallback: (ExportVideoProgress) -> Unit? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): List<ByteBuffer>

Exports multiple design blocks as video files of the given mime type, one after the other, with one background engine. Otherwise it works like the exportVideo overload for one block.

abstract suspend fun exportVideo(blocks: List<DesignBlock>, timeOffset: Double, duration: Double, mimeType: MimeType, progressCallback: (ExportVideoProgress) -> Unit, options: ExportVideoOptions? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): List<ByteBuffer>

Exports multiple design blocks as video files of the given mime type. Note: MP4 exports embed a PNG cover at the page cover time when playback/coverTimeEnabled is true, else at the page playback position. coverTimeOffset overrides both. An MP4 export of a scene uses its first frame as the cover. Videos are exported sequentially, with progress reported for each video. This method is more memory efficient than calling exportVideo repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

Link copied to clipboard
abstract suspend fun exportWithColorMask(block: DesignBlock, mimeType: MimeType, maskColor: RGBAColor, options: ExportOptions? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): Pair<ByteBuffer, ByteBuffer>

Exports a design block element as a file of the given mime type. The export of a page slice gives the part of its page inside the page slice, with the bleed of the page on all four sides. At a fold, that bleed shows the content of the page slice beside it. The export of a hidden page slice shows it and its content. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

abstract suspend fun exportWithColorMask(blocks: List<DesignBlock>, mimeType: MimeType, maskColor: RGBAColor, options: ExportOptions? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): List<Pair<ByteBuffer, ByteBuffer>>

Exports multiple design block elements as files of the given mime type with color masks. Performs an internal update to resolve the final layout for the blocks. This method is more memory efficient than calling exportWithColorMask repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

Link copied to clipboard
abstract fun fillParent(block: DesignBlock)

Resize and position a block to entirely fill its parent block. The crop values of the block, except for the flip and crop rotation, are reset if it can be cropped. If the size of the block's fill is unknown, the content fill mode is changed from Crop to Cover to prevent invalid crop values. A block that follows a transform parent stops following it. A page slice takes its position from its page, so the call fails with BLOCK.POSITION_PARENT_CONTROLLED on one. Required scope: "layer/move"

Link copied to clipboard
abstract fun findAll(): List<DesignBlock>

Return all blocks currently known to the engine.

Link copied to clipboard

Gets the sorted names of the published properties of a main component.

Link copied to clipboard

Returns all blocks that overlap an exclusion area on their page.

Link copied to clipboard
abstract fun findAllMetadata(block: DesignBlock): List<String>

Query all metadata keys that exist on this block.

Link copied to clipboard

Return all placeholder blocks in the current scene.

Link copied to clipboard
abstract fun findAllProperties(block: DesignBlock): List<String>

Get all available properties of a block.

Link copied to clipboard

Get all currently selected blocks.

Link copied to clipboard
abstract fun findAllUnused(): List<DesignBlock>

Return all blocks that are not attached to any scene.

Link copied to clipboard

Get the properties of a block that are bound to a variable.

Link copied to clipboard
abstract fun findAllVariantProperties(component: DesignBlock): List<String>

Gets the sorted names of the variant properties of a main component.

Link copied to clipboard
abstract fun findByKind(blockKind: String): List<DesignBlock>

Finds all blocks with the given kind.

Link copied to clipboard
abstract fun findByName(name: String): List<DesignBlock>

Finds all blocks with the given name.

Link copied to clipboard
abstract fun findByType(type: String): List<DesignBlock>

Finds all design blocks with the given type.

abstract fun findByType(type: BlurType): List<DesignBlock>

Finds all blur blocks with the given type.

abstract fun findByType(type: EffectType): List<DesignBlock>

Finds all effect blocks with the given type.

abstract fun findByType(type: MaskType): List<DesignBlock>

Finds all mask blocks.

abstract fun findByType(type: ModifierType): List<DesignBlock>

Finds all modifier blocks with the given type.

abstract fun findByType(type: ShapeType): List<DesignBlock>

Finds all shape blocks with the given type.

Finds all text animator blocks.

Link copied to clipboard
abstract fun flipCropHorizontal(block: DesignBlock)

Adjusts the crop in order to flip the content along its own horizontal axis.

Link copied to clipboard
abstract fun flipCropVertical(block: DesignBlock)

Adjusts the crop in order to flip the content along its own vertical axis.

Link copied to clipboard
abstract suspend fun forceLoadAVResource(block: DesignBlock)

Begins loading the required audio and video resource for the given video fill or audio block. If the resource had been loaded earlier and resulted in an error, it will be reloaded. A buffer:// source loads like a file. The call finishes once the engine can read the video, audio or Lottie in the buffer, with the images that a Lottie references. It fails when the buffer holds no file that it can read. A missing or empty buffer, or raw audio samples on an audio block, finish at once.

Link copied to clipboard
abstract suspend fun forceLoadResources(blocks: List<DesignBlock>)

Begins loading the resources of the given blocks and their children. If the resource had been loaded earlier and resulted in an error, it will be reloaded. Note: This function is useful for preloading resources before they are needed. A page slice also loads the resources of the blocks that it owns on its page. The call runs no update, so a block that no update has placed on the page slice yet is left out. Warning: For elements with a source set, all elements in the source set will be loaded.

Link copied to clipboard
abstract fun generateAudioThumbnailSequence(block: DesignBlock, samplesPerChunk: Int, timeBegin: Double, timeEnd: Double, numberOfSamples: Int, numberOfChannels: Int): Flow<AudioThumbnailResult>

Generate a thumbnail sequence for the given audio block or video fill. A thumbnail in this case is a chunk of samples in the range of 0 to 1. In case stereo data is requested, the samples are interleaved, starting with the left channel. Note: Only one request per block runs at a time. A second request for the same block waits for the first to finish instead of failing. Note: numberOfSamples counts samples per channel, so each emission carries samplesPerChunk * numberOfChannels floats and the last one may be shorter. Note: A chunk arrives at the end of an engine update. Cancelling the collecting coroutine also drops the chunks that wait for delivery. Note: Collect on the main thread; collection throws otherwise.

Link copied to clipboard
abstract fun generateVideoThumbnailSequence(block: DesignBlock, thumbnailHeight: Int, timeBegin: Double, timeEnd: Double, numberOfFrames: Int): Flow<VideoThumbnailResult>

Generate a thumbnail sequence for the given video fill or design block. Note: Only one request per block runs at a time. A second request for the same block waits for the first to finish instead of failing. Note: For a video fill, cancelling has no effect once the first frame has been scheduled — the engine still produces the remaining frames. Cancelling the collecting coroutine stops your collector from seeing them. Design block sequences cancel at any time. Note: A frame arrives at the end of an engine update, after the update that rendered it. Note: Collect on the main thread; collection throws otherwise.

Link copied to clipboard

Get the properties of a block that have keyframes.

Link copied to clipboard
abstract fun getAnimatedValue(block: DesignBlock, property: String, time: Float): KeyframeValue

Get the value that the keyframes give a block property at a time. A relative track adds the static value. A property without keyframes gives its static value. A position/x or position/y track overrides that axis of a position track. Without its own track, position/x gives the x of the position track. An angle is in the angle unit of the scene. Animation presets and the turn along a motion path are not included. A rotation track also moves a block without an anchor, so that it turns around its frame centre. That move is not included either. Throws BLOCK.KEYFRAMES_TIME_OUT_OF_RANGE for a time outside 0, 1, or BLOCK.KEYFRAMES_PROPERTY_NOT_ANIMATABLE when the property has no keyframes and isPropertyAnimatable returns false.

Link copied to clipboard

Get information about all audio tracks from a video fill block.

Link copied to clipboard
abstract fun getAudioTrackCountFromVideo(videoFill: DesignBlock): Int

Get the number of available audio tracks in a video fill block.

Link copied to clipboard

Get the duration in seconds of the video or audio resource that is attached to the given block.

Link copied to clipboard

Get the background color of the given design block.

Link copied to clipboard
abstract fun getBlendMode(block: DesignBlock): BlendMode

Get the blend mode of the given design block.

Link copied to clipboard
abstract fun getBlur(block: DesignBlock): DesignBlock

Get the blur block of the given design block. For example, a graphic has no blur right after create(DesignBlockType.Graphic), although isBlurEnabled returns true.

Link copied to clipboard
abstract fun getBoolean(block: DesignBlock, property: String): Boolean

Get the value of a boolean property of the given design block.

Link copied to clipboard
abstract fun getChildren(block: DesignBlock): List<DesignBlock>

Get all children of the given block. Children are sorted in their rendering order: Last child is rendered in front of other children.

Link copied to clipboard
abstract fun getColor(block: DesignBlock, property: String): Color

Get the value of a color property of the given design block.

Link copied to clipboard
abstract fun getComponentProperty(instance: DesignBlock, name: String): String

Gets a published property of an instance as text.

Link copied to clipboard

Query a block's horizontal content fill alignment.

Link copied to clipboard

Query a block's content fill mode.

Link copied to clipboard

Query a block's vertical content fill alignment.

Link copied to clipboard
abstract fun getCropRotation(block: DesignBlock): Float

Get the crop rotation of the given design block.

Link copied to clipboard
abstract fun getCropScaleRatio(block: DesignBlock): Float

Get the crop scale ratio of the given design block. On a page with a bleed, a ratio of 1 means that the content covers the page and its bleed. This needs the setting page/imageFillCoversBleed, which is on by default.

Link copied to clipboard
abstract fun getCropScaleX(block: DesignBlock): Float

Get the crop scale in x direction of the given design block.

Link copied to clipboard
abstract fun getCropScaleY(block: DesignBlock): Float

Get the crop scale in y direction of the given design block.

Link copied to clipboard
abstract fun getCropTranslationX(block: DesignBlock): Float

Get the crop translation in x direction of the given design block.

Link copied to clipboard
abstract fun getCropTranslationY(block: DesignBlock): Float

Get the crop translation in y direction of the given design block.

Link copied to clipboard
abstract suspend fun getDominantColors(block: DesignBlock, options: DominantColorsOptions = DominantColorsOptions()): List<DominantColor>

Extracts the dominant colors from the rendered appearance of a block.

Link copied to clipboard
abstract fun getDouble(block: DesignBlock, property: String): Double

Get the value of a double property of the given design block.

Link copied to clipboard

Get the drop shadow's blur radius on the x axis of the given design block.

Link copied to clipboard

Get the drop shadow's blur radius on the y axis of the given design block.

Link copied to clipboard
abstract fun getDropShadowClip(block: DesignBlock): Boolean

Get the drop shadow's clipping of the given design block.

Link copied to clipboard
abstract fun getDropShadowColor(block: DesignBlock): Color

Get the drop shadow color of the given design block.

Link copied to clipboard
abstract fun getDropShadowOffsetX(block: DesignBlock): Float

Get the drop shadow's x offset of the given design block.

Link copied to clipboard
abstract fun getDropShadowOffsetY(block: DesignBlock): Float

Get the drop shadow's y offset of the given design block.

Link copied to clipboard
abstract fun getDuration(block: DesignBlock): Double

Get the playback duration of the given block in seconds. The duration defines for how long the block is active in the scene during playback. For a scene, the sum of the durations of its pages, without the pages hidden with setVisible. Note: The duration is ignored when the scene is not in Video mode.

Link copied to clipboard
abstract fun getEffects(block: DesignBlock): List<DesignBlock>

Get a list of all effects attached to this block.

Link copied to clipboard
abstract fun getEffectSource(effectBlock: DesignBlock): DesignBlock?

Get the block that an effect block reads.

Link copied to clipboard
abstract fun getEnum(block: DesignBlock, property: String): String

Get the value of an enum property of the given design block.

Link copied to clipboard
abstract fun getEnumValues(enumProperty: String): List<String>

Get all the possible values of an enum given an enum property.

Link copied to clipboard
abstract fun getFill(block: DesignBlock): DesignBlock

Returns the block containing the fill properties of the given block. For example, a graphic has no fill right after create(DesignBlockType.Graphic), although isFillEnabled returns true.

Link copied to clipboard
abstract fun getFillOverprint(block: DesignBlock): Boolean

Query whether the fill of the given design block is marked as overprint.

Link copied to clipboard

Get the fill color of the given design block.

Link copied to clipboard
abstract fun getFloat(block: DesignBlock, property: String): Float

Get the value of a float property of the given design block.

Link copied to clipboard
abstract fun getFontRequests(block: DesignBlock, from: Int = -1, to: Int = -1): List<FontRequest>

Returns unique stored requests intersecting the text range. Legacy URI fonts have no request.

Link copied to clipboard
abstract fun getFrameHeight(block: DesignBlock): Float

Get a block's layout height. The layout height is only available after an internal update loop, which may not happen immediately.

Link copied to clipboard
abstract fun getFrameWidth(block: DesignBlock): Float

Get a block's layout width. The layout width is only available after an internal update loop, which may not happen immediately.

Link copied to clipboard
abstract fun getFrameX(block: DesignBlock): Float

Get a block's layout position on the x-axis. The layout position is only available after an internal update loop, which may not happen immediately.

Link copied to clipboard
abstract fun getFrameY(block: DesignBlock): Float

Get a block's layout position on the y-axis. The layout position is only available after an internal update loop, which may not happen immediately.

Link copied to clipboard

Get the height of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.

Link copied to clipboard

Get the width of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.

Link copied to clipboard

Get the x position of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.

Link copied to clipboard

Get the y position of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.

Link copied to clipboard

Get the gradient color stops property of the given design block.

Link copied to clipboard
abstract fun getHeight(block: DesignBlock): Float

Query a block's height.

Link copied to clipboard
abstract fun getHeightMode(block: DesignBlock): SizeMode

Query a block's mode for its height.

Link copied to clipboard
abstract fun getInAnimation(block: DesignBlock): DesignBlock

Get the "in" animation of the given block.

Link copied to clipboard
abstract fun getInt(block: DesignBlock, property: String): Int

Get the value of an int property of the given design block.

Link copied to clipboard
abstract fun getKeyframeMode(block: DesignBlock, property: String): TrackMode

Get the mode of the keyframe track of a block property. Throws BLOCK.KEYFRAMES_NO_TRACK when the property has no keyframes, or BLOCK.KEYFRAMES_PROPERTY_NOT_ANIMATABLE when isPropertyAnimatable also returns false.

Link copied to clipboard
abstract fun getKeyframes(block: DesignBlock, property: String): List<Keyframe>

Get the keyframes of a block property, sorted by time. Throws BLOCK.KEYFRAMES_PROPERTY_NOT_ANIMATABLE when the property has no keyframes and isPropertyAnimatable returns false.

Link copied to clipboard
abstract fun getKind(block: DesignBlock): String

Get the kind of the given block, fails if the block is invalid.

Link copied to clipboard

Get the "loop" animation of the given block.

Link copied to clipboard
abstract fun getMainComponent(instance: DesignBlock): DesignBlock

Gets the main component of an instance.

Link copied to clipboard
abstract fun getMasks(block: DesignBlock): List<DesignBlock>

Get the masks of a block, in the order in which they combine.

Link copied to clipboard
abstract fun getMatte(block: DesignBlock): BlockMatte?

Get the matte of a block.

Link copied to clipboard
abstract fun getMetadata(block: DesignBlock, key: String): String

Get a metadata value of a block identified by a key. If the key does not exist, yet, this method will fail.

Link copied to clipboard
abstract fun getModifiers(block: DesignBlock): List<DesignBlock>

Get the modifiers of a shape, in the order they apply to its path.

Link copied to clipboard
abstract fun getName(block: DesignBlock): String

Get a block's name.

Link copied to clipboard
@FloatRange(from = 0.0, to = 1.0)
abstract fun getOpacity(block: DesignBlock): Float

Get the opacity of the given design block.

Link copied to clipboard

Gets the "out" animation of the given block.

Link copied to clipboard

Returns the page slice that owns a block on its page. A page slice has no children, so the block is a child of the page, or of a group on the page. The page slice under the center of the block owns it. On a fold, the earlier page slice owns it. A block outside the page belongs to the nearest page slice. A block in a group belongs where its group does. Note that the call runs an internal update when the block has no frame. It does the same when the page has page slices that no update laid out yet.

Link copied to clipboard

Returns the page slices of a page, in reading order. The list holds hidden page slices too. It is the order of the page slices among the children of the page.

Link copied to clipboard
abstract fun getParent(block: DesignBlock): DesignBlock?

Query a block's parent.

Link copied to clipboard
abstract fun getPlaybackSpeed(block: DesignBlock): Float

Gets the playback speed multiplier of a block that supports playback control.

Link copied to clipboard
abstract fun getPlaybackTime(block: DesignBlock): Double

Get the playback time of the given block. During an export, this returns the time of the playhead and not the time of the exported frame.

Link copied to clipboard
abstract fun getPositionX(block: DesignBlock): Float

Query a block's x position. The position is the block's local origin: the top-left corner of its untransformed frame, in the coordinate space of its parent. Rotation turns the block, and a flip mirrors it, around the center of its frame. So for a rotated or flipped block, the position is not the visual left edge. Use getGlobalBoundingBoxX for the axis-aligned visual bounds.

Link copied to clipboard

Query a block's mode for its x position. x * On a page slice the mode is PositionMode.AUTO, because the page sets its position. x * @param block the block to query.

Link copied to clipboard
abstract fun getPositionY(block: DesignBlock): Float

Query a block's y position. The position is the block's local origin: the top-left corner of its untransformed frame, in the coordinate space of its parent. Rotation turns the block, and a flip mirrors it, around the center of its frame. So for a rotated or flipped block, the position is not the visual top edge. Use getGlobalBoundingBoxY for the axis-aligned visual bounds.

Link copied to clipboard

Query a block's mode for its y position. y * On a page slice the mode is PositionMode.AUTO, because the page sets its position. y * @param block the block to query.

Link copied to clipboard
abstract fun getPropertyType(property: String): PropertyType

Get the type of a property given its name.

Link copied to clipboard
abstract fun getRotation(block: DesignBlock): Float

Query a block's rotation in the scene's angle unit (radians by default, see SceneApi.setAngleUnit).

Link copied to clipboard

Get the position and size of the axis-aligned bounding box for the given blocks in screen space.

Link copied to clipboard
abstract fun getShape(block: DesignBlock): DesignBlock

Returns the block containing the shape properties of the given block. For example, a graphic has no shape right after create(DesignBlockType.Graphic).

Link copied to clipboard
abstract fun getSourceSet(block: DesignBlock, property: String): List<Source>

Returns the source set of a source set property of the given block.

Link copied to clipboard

Get the name of the spot color assigned to a cutout type.

Link copied to clipboard
abstract fun getState(block: DesignBlock): BlockState

Get the current state of a block. Note If this block is in error state or this block has a Shape block, Fill block or Effect block(s), that is in error state, the returned state will be BlockState.Error. Else, if this block is in pending state or this block has a Shape block, Fill block or Effect block(s), that is in pending state, the returned state will be BlockState.Pending. Else, the returned state will be BlockState.Ready. A BlockState.Error carries the catalog error of the failed load in BlockState.Error.engineError when the engine knows it, such as a .lottie archive that cannot be read or a video that cannot be decoded. Note: A block whose CMYK or spot color needs the document CMYK profile is BlockState.Pending while that profile loads. Note: With soft proofing on, a block that draws inside a page is BlockState.Pending while the proof profile loads. It reports a BlockState.Error.Type.SOFT_PROOF error only when it has no other error or pending state. Note: Runs an engine update for a resource that nothing asked for yet, while the scene has a change to lay out. A font set just before this call is then reported as pending.

Link copied to clipboard
abstract fun getString(block: DesignBlock, property: String): String

Get the value of a string property of the given design block.

Link copied to clipboard
abstract fun getStrokeColor(block: DesignBlock): Color

Get the stroke color of the given design block.

Link copied to clipboard

Get the stroke corner geometry of the given design block.

Link copied to clipboard
abstract fun getStrokeDashArray(block: DesignBlock): List<Float>

Get the custom dash pattern of the given design block's stroke.

Link copied to clipboard

Query the cap geometry at the trailing edge of each dash piece.

Link copied to clipboard
abstract fun getStrokeDashOffset(block: DesignBlock): Float

Get the dash offset of the given design block's stroke.

Link copied to clipboard

Query the cap geometry at the leading edge of each dash piece.

Link copied to clipboard
abstract fun getStrokeEndCap(block: DesignBlock): StrokeCap

Query the cap geometry at the end of an open stroked path.

Link copied to clipboard
abstract fun getStrokeFill(block: DesignBlock): DesignBlock?

Returns the fill block that paints the stroke of the given block.

Link copied to clipboard
abstract fun getStrokeOverprint(block: DesignBlock): Boolean

Query whether the stroke of the given design block is marked as overprint.

Link copied to clipboard

Get the stroke position of the given design block.

Link copied to clipboard

Query the cap geometry at the start of an open stroked path.

Link copied to clipboard
abstract fun getStrokeStyle(block: DesignBlock): StrokeStyle

Get the stroke style of the given design block.

Link copied to clipboard
abstract fun getStrokeWidth(block: DesignBlock): Float

Get the stroke width of the given design block.

Link copied to clipboard
abstract fun getSubshapes(block: DesignBlock): List<DesignBlock>

Get the subshapes of a compound shape, in the order in which they combine.

Link copied to clipboard

Get the text animators of a block, in the order they apply.

Link copied to clipboard
abstract fun getTextAsHTML(block: DesignBlock, from: Int = -1, to: Int = -1): String

Returns a range of a text block as HTML with its formatting, for the clipboard. The HTML states the color, background color, weight, italic, decorations, script style, case, font size and typeface of each run as inline CSS. It states the list style, list level and alignment of each paragraph. Other apps read it on paste, and replaceTextWithHTML reads every property back. The typeface applies only when a typeface of the scene holds its font file. The font size and the line height are CSS values, so other apps show them as the block does.

Link copied to clipboard
abstract fun getTextBackgroundColors(block: DesignBlock, from: Int = -1, to: Int = -1): List<Color>

Returns the ordered unique list of background colors of the text in the selected range. Text without a background color is reported as a fully transparent color.

Link copied to clipboard
abstract fun getTextBaselineShifts(block: DesignBlock, from: Int = -1, to: Int = -1): List<Float>

Returns the unique baseline shift values across the grapheme range, in design units.

Link copied to clipboard
abstract fun getTextCases(block: DesignBlock, from: Int = -1, to: Int = -1): List<TextCase>

Returns the ordered list of text cases of the text in the selected range.

Link copied to clipboard
abstract fun getTextCharacterInkBoxes(block: DesignBlock, from: Int = -1, to: Int = -1): List<CharacterInkBox>

Returns the tight ink-paint bounding box of each grapheme in the given range. Required scope: "text/character"

Link copied to clipboard
abstract fun getTextColors(block: DesignBlock, from: Int = -1, to: Int = -1): List<Color>

Returns the ordered unique list of colors of the text in the selected range.

Link copied to clipboard
abstract fun getTextCursorRange(): IntRange?

Returns the indices of the selected range of the text block that is currently being edited. If both the start and end index of the returned range have the same value, then the text cursor is positioned at that index.

Link copied to clipboard
abstract fun getTextDecorations(block: DesignBlock, from: Int = -1, to: Int = -1): List<TextDecorationConfig>

Returns the ordered list of unique text decoration configurations in the selected range.

Link copied to clipboard

Gets the effective horizontal alignment of a text block. If the alignment is set to Auto, this returns the resolved alignment (Left or Right) based on the text direction of the first logical run. This never returns 'Auto'.

Link copied to clipboard
abstract fun getTextFontSizes(block: DesignBlock, from: Int = -1, to: Int = -1): List<Float>

Returns the ordered unique list of font sizes of the text in the selected range.

Link copied to clipboard
abstract fun getTextFontStyles(block: DesignBlock, from: Int = -1, to: Int = -1): List<FontStyle>

Returns the ordered unique list of font styles of the text in the selected range.

Link copied to clipboard
abstract fun getTextFontWeights(block: DesignBlock, from: Int = -1, to: Int = -1): List<FontWeight>

Returns the ordered unique list of font weights of the text in the selected range.

Link copied to clipboard
abstract fun getTextHorizontalAlignment(block: DesignBlock, paragraphIndex: Int = -1): HorizontalAlignment?

Returns the paragraph-level horizontal alignment override for a specific paragraph, or the block-level alignment for negative paragraph indices.

Link copied to clipboard
abstract fun getTextKernings(block: DesignBlock, from: Int = -1, to: Int = -1): List<Float>

Returns the unique kerning values across the grapheme range.

Link copied to clipboard
abstract fun getTextLineBoundingBoxRect(block: DesignBlock, index: Int): RectF

Returns the bounds of the visible area of the given line of the text block. The values are in the scene's global coordinate space (which has its origin at the top left).

Link copied to clipboard
abstract fun getTextLineHeight(block: DesignBlock, paragraphIndex: Int): Float

Returns the line height multiplier for a specific paragraph of a text block.

Link copied to clipboard
abstract fun getTextListLevel(block: DesignBlock, paragraphIndex: Int): Int

Returns the list nesting level for a specific paragraph of a text block.

Link copied to clipboard
abstract fun getTextListStyle(block: DesignBlock, paragraphIndex: Int): ListStyle

Returns the list style for a specific paragraph of a text block.

Link copied to clipboard
abstract fun getTextOnPath(block: DesignBlock): String?

Returns the SVG path currently used as the text block's baseline, or null if normal layout is active.

Link copied to clipboard

Returns whether text is placed on the opposite side of the baseline path.

Link copied to clipboard
abstract fun getTextOnPathOffset(block: DesignBlock): Float

Returns the start offset along the baseline path as a proportion of the path length.

Link copied to clipboard
abstract fun getTextOpenTypeFeatures(block: DesignBlock, from: Int = -1, to: Int = -1): List<List<OpenTypeFeature>>

Returns the unique OpenType feature lists across the grapheme range. Each list holds one entry per tag, sorted by tag. A range without features returns one empty list.

Link copied to clipboard
abstract fun getTextParagraphIndices(block: DesignBlock, from: Int = -1, to: Int = -1): List<Int>

Returns the 0-based paragraph indices that overlap the given range.

Link copied to clipboard

Returns current font provenance, missing glyph ranges, and optional planar layout.

Link copied to clipboard
abstract fun getTextRuns(block: DesignBlock, from: Int = -1, to: Int = -1, unit: FontUnit = FontUnit.POINT): List<TextRunInfo>

Returns all text runs within the given range of text.

Link copied to clipboard
abstract fun getTextScriptStyles(block: DesignBlock, from: Int = -1, to: Int = -1): List<ScriptStyle>

Returns the ordered list of unique script styles of the text in the selected range.

Link copied to clipboard
abstract fun getTextVariationAxes(block: DesignBlock, from: Int = -1, to: Int = -1): List<List<VariationAxisValue>>

Returns the unique variation axis value lists across the grapheme range. Each list holds one entry per tag, sorted by tag. A range without axis values returns one empty list.

Link copied to clipboard
abstract fun getTextVisibleLineContent(block: DesignBlock, lineIndex: Int): String

Returns the text content of the given visible line of the text block.

Link copied to clipboard

Returns the number of visible lines in the given text block.

Link copied to clipboard
abstract fun getTimeOffset(block: DesignBlock): Double

Get the time offset of the given block relative to its parent.

Link copied to clipboard

Returns the block whose transform the given block follows.

Link copied to clipboard
abstract fun getTransition(block: DesignBlock): DesignBlock

Gets the outgoing transition assigned to a clip.

Link copied to clipboard
abstract fun getTrimLength(block: DesignBlock): Double

Get the trim length of the given block or fill.

Link copied to clipboard
abstract fun getTrimOffset(block: DesignBlock): Double

Get the trim offset of this block. Note: This requires the video or audio clip to be loaded.

Link copied to clipboard
abstract fun getType(block: DesignBlock): String

Get the type of the given block, fails if the block is invalid.

Link copied to clipboard
abstract fun getTypeface(block: DesignBlock): Typeface

Returns the typeface property of the text block. Does not return the typefaces of the text runs.

Link copied to clipboard
abstract fun getTypefaces(block: DesignBlock, from: Int = -1, to: Int = -1): List<Typeface>

Returns the typefaces of the text block.

Link copied to clipboard
abstract fun getUri(block: DesignBlock, property: String): Uri

Get the value of a uri property of the given design block.

Link copied to clipboard
abstract fun getUUID(block: DesignBlock): String

Get a block's unique identifier.

Link copied to clipboard
abstract fun getVariableBinding(block: DesignBlock, property: String): String?

Get the variable that a block property is bound to.

Link copied to clipboard
abstract fun getVariantProperty(component: DesignBlock, name: String): String

Gets the value of a variant property of a main component.

Link copied to clipboard
abstract fun getVec2(block: DesignBlock, property: String): Vector2

Get the value of a vec2 property of the given design block.

Link copied to clipboard
abstract fun getVideoHeight(videoFill: DesignBlock): Int

Get the video height in pixels of the video resource that is attached to the given block.

Link copied to clipboard
abstract fun getVideoWidth(videoFill: DesignBlock): Int

Get the video width in pixels of the video resource that is attached to the given block.

Link copied to clipboard
@FloatRange(from = 0.0, to = 1.0)
abstract fun getVolume(block: DesignBlock): Float

Get the audio volume of the given block.

Link copied to clipboard
abstract fun getWidth(block: DesignBlock): Float

Query a block's width.

Link copied to clipboard
abstract fun getWidthMode(block: DesignBlock): SizeMode

Query a block's mode for its width.

Link copied to clipboard
abstract fun group(blocks: List<DesignBlock>): DesignBlock

Group blocks together. The group becomes the blocks' new parent and takes the first block's parent as its own. Grouping does not change the children's positions: they stay relative to the group's parent, not to the group. In nested groups, they stay relative to the first ancestor that is not a group. The engine computes the group's position and size from the children's combined bounds. Moving the group moves all of its children by the same offset.

Link copied to clipboard
abstract fun hasMetadata(block: DesignBlock, key: String): Boolean

Check if the block has metadata associated with the key.

Link copied to clipboard
abstract fun hasTransformAnchor(block: DesignBlock): Boolean

Returns whether a block has its own anchor. Setting transform/anchor/x or transform/anchor/y, even to 0, or giving one of them keyframes, gives a block an anchor. A rotation keyframe track turns a block with an anchor around the anchor, and a block without one around its frame center, as setRotation does.

Link copied to clipboard
abstract fun insertChild(parent: DesignBlock, child: DesignBlock, index: Int)

Insert a new or existing child at a certain position in the parent's children. A move fails when it would put a block with a matte inside its matte source, or on another page than its source. A page slice takes no children, and it can only be a child of a page with a rect shape. A video scene takes no page slice. A page slice that a block load or duplicate returns holds the blocks that it was saved with. The next update moves them onto the page, into the new place of the page slice. Required scope: "editor/add"

Link copied to clipboard
abstract fun insertEffect(block: DesignBlock, effectBlock: DesignBlock, index: Int)

Inserts an effect at the given index into the list of effects of the given block. The same effect can appear multiple times in the list and won't be removed if appended again. Required scope: "appearance/effect"

Link copied to clipboard
abstract fun insertMask(block: DesignBlock, maskBlock: DesignBlock, index: Int)

Inserts a mask at the given index into the masks of the block. A mask can be used by more than one block. Required scope: "layer/clipping"

Link copied to clipboard
abstract fun insertModifier(block: DesignBlock, modifierBlock: DesignBlock, index: Int)

Inserts a modifier at the given index into the modifiers of a shape. The same modifier can appear multiple times in the list. Required scope: "shape/change" on every block that uses the shape.

Link copied to clipboard
abstract fun insertSubshape(block: DesignBlock, subshapeBlock: DesignBlock, index: Int)

Inserts a subshape at the given index of a compound shape. The subshape at index 0 is the base, and each later subshape combines with the result so far by shape/compound/mode. The placement properties of the subshape (shape/position/x, shape/width, shape/rotation, ...) place it in the compound's coordinate space. A shape has one owner, so the subshape is detached from its previous block or compound shape. Line shapes cannot be subshapes. The call fails when the shape tree would nest more than 128 shapes. Required scope: "shape/change"

Link copied to clipboard
abstract fun insertTextAnimator(block: DesignBlock, animatorBlock: DesignBlock, index: Int)

Inserts a text animator at the given index into the text animators of a block. A text animator belongs to one block at a time. Required scope: "appearance/animation"

Link copied to clipboard
abstract fun isAlignable(blocks: List<DesignBlock>): Boolean

Confirms that a given set of blocks can be aligned.

Link copied to clipboard
abstract fun isAllowedByScope(block: DesignBlock, key: String): Boolean

Check if a scope is allowed for a given block.

Link copied to clipboard
abstract fun isAlwaysOnBottom(block: DesignBlock): Boolean

Query a block's always-on-bottom property.

Link copied to clipboard
abstract fun isAlwaysOnTop(block: DesignBlock): Boolean

Query a block's always-on-top property.

Link copied to clipboard
abstract fun isAVResourceLoaded(block: DesignBlock): Boolean

Returns whether the audio and video resource for the given video fill or audio block is loaded. Note that the function is unstable and mared with UnstableEngineApi. A buffer:// source counts as loaded once the engine has read its file, with the images that a Lottie references. A missing or empty buffer, or raw audio samples on an audio block, count as loaded.

Link copied to clipboard

Query if the background of the given design block is enabled.

Link copied to clipboard
abstract fun isBlurEnabled(block: DesignBlock): Boolean

Query if blur is enabled for the given block. The flag does not depend on an attached blur block. It defaults to true, so a fresh graphic reports its blur as enabled while getBlur returns an invalid block.

Link copied to clipboard
abstract fun isClipped(block: DesignBlock): Boolean

Query a block's clipped state. If true, the block should clip

Link copied to clipboard
abstract fun isCombinable(blocks: List<DesignBlock>): Boolean

Checks whether blocks could be combined.

Link copied to clipboard
abstract fun isComponent(block: DesignBlock): Boolean

Checks whether a block is a main component.

Link copied to clipboard

Check if the crop aspect ratio is locked for the given block. When locked, crop handles will maintain the current aspect ratio during resize.

Link copied to clipboard
abstract fun isDistributable(blocks: List<DesignBlock>): Boolean

Confirms that a given set of blocks can be distributed. A page slice cannot be distributed, so the result is false when blocks holds one.

Link copied to clipboard

Query if the drop shadow of the given design block is enabled.

Link copied to clipboard
abstract fun isEffectEnabled(effectBlock: DesignBlock): Boolean

Queries whether an effect block is enabled and therefore applies its effect.

Link copied to clipboard
abstract fun isFillEnabled(block: DesignBlock): Boolean

Query if the fill of the given design block is enabled. The flag does not depend on an attached fill block. It defaults to true, so a fresh graphic reports its fill as enabled while getFill returns an invalid block.

Link copied to clipboard
abstract fun isFlipHorizontal(block: DesignBlock): Boolean

Query a block's horizontal flip state.

Link copied to clipboard
abstract fun isFlipVertical(block: DesignBlock): Boolean

Query a block's vertical flip state.

Link copied to clipboard
abstract fun isForceMuted(block: DesignBlock): Boolean

Query whether the block is muted due to engine constraints.

Link copied to clipboard
abstract fun isGroupable(blocks: List<DesignBlock>): Boolean

Confirms that a given set of blocks can be grouped together. A caption or a caption track cannot be grouped, because a caption plays from the caption track of its page.

Link copied to clipboard
abstract fun isIncludedInExport(block: DesignBlock): Boolean

Query if the given block is included on the exported result.

Link copied to clipboard
abstract fun isInstance(block: DesignBlock): Boolean

Checks whether a block is the top block of an instance.

Link copied to clipboard
abstract fun isLineOrigin(block: DesignBlock): Boolean

Checks whether a graphic block originated as a line shape.

Link copied to clipboard
abstract fun isLooping(block: DesignBlock): Boolean

Query whether the block is looping.

Link copied to clipboard
abstract fun isMuted(block: DesignBlock): Boolean

Query whether the block is muted.

Link copied to clipboard

Returns whether the block is a duration source block.

Link copied to clipboard

Query whether the placeholder behavior for a block is enabled.

Link copied to clipboard

Query whether the placeholder button for a block is shown.

Link copied to clipboard

Query whether the placeholder overlay pattern for a block is shown.

Link copied to clipboard

Query whether the placeholder function for a block is enabled.

Link copied to clipboard
abstract fun isPlaying(block: DesignBlock): Boolean

Returns whether the block is currently during active playback.

Link copied to clipboard
abstract fun isPropertyAnimatable(block: DesignBlock, property: String): Boolean

Check whether a property of a block can have keyframes.

Link copied to clipboard
abstract fun isPropertyReadable(property: String): Boolean

Check if a property with a given name is readable.

Link copied to clipboard
abstract fun isPropertyWritable(property: String): Boolean

Check if a property with a given name is writeable.

Link copied to clipboard
abstract fun isPropertyWriteable(property: String): Boolean

Check if a property with a given name is writeable.

Link copied to clipboard
abstract fun isScopeEnabled(block: DesignBlock, key: String): Boolean

Query whether a scope is enabled for a given block.

Link copied to clipboard
abstract fun isSelected(block: DesignBlock): Boolean

Get the selected state of a block.

Link copied to clipboard

Return whether the given block or fill is currently set to play its contents while the rest of the scene remains paused.

Link copied to clipboard
abstract fun isStrokeEnabled(block: DesignBlock): Boolean

Query if the stroke of the given design block is enabled.

Link copied to clipboard
abstract fun isTransformLocked(block: DesignBlock): Boolean

Query a block's transform locked state. If true, the block's transform can't be changed. The lock covers the static transform: keyframe tracks on the position, rotation, size, scale, anchor or skew still animate a locked block.

Link copied to clipboard
abstract fun isValid(block: DesignBlock): Boolean

Check if a block is valid. A block becomes invalid once it has been destroyed.

Link copied to clipboard
abstract fun isVisible(block: DesignBlock): Boolean

Query a block's visibility.

Link copied to clipboard

Returns whether the block should be visible on the canvas at the current playback time.

Link copied to clipboard
abstract suspend fun loadFromArchive(archiveUri: Uri): List<DesignBlock>

Loads existing blocks from an archive. The archiveUri should be that of a file previously saved with saveToArchive. The blocks are not attached by default and won't be visible until attached to a page or the scene. The UUID of the loaded blocks is replaced with a new one.

Link copied to clipboard
abstract suspend fun loadFromString(block: String): List<DesignBlock>

Loads existing blocks from the given string. The blocks are not attached by default and won't be visible until attached to a page or the scene. The UUID of the loaded blocks is replaced with a new one. A damaged string, such as one with a missing key or a value of the wrong type, throws and adds no block.

Link copied to clipboard
abstract suspend fun loadFromURL(url: Uri): List<DesignBlock>

Loads existing blocks from a URL.

Link copied to clipboard
abstract fun movePageSliceIntoPage(pageOrPageSlice: DesignBlock, page: DesignBlock, index: Int, options: MovePageSliceOptions = MovePageSliceOptions()): DesignBlock

Moves a page without page slices, or a page slice of another page, into a page with page slices. The content of the moved page or page slice moves along and keeps its ids. A moved page slice keeps its id. A page becomes a new page slice, and its id becomes invalid. The page slice keeps its size along the axis of page and takes the shared size across it. The moved content is placed above the content of page, in its own order. When the move takes the last page slice of its page, that page stays as an empty page without page slices. The move fails when a content block would change the page slice that owns it. Conversion keeps the supported appearance keyframes. Tracks of a page slice use the playback clock of its page. Conversion refuses preset animations and other tracks, such as geometry and crop tracks. MovePageSliceOptions.convertSourceToPage refuses a remaining page slice with preset animations or keyframes. Note that the call runs an internal update even when implicit updates are disabled. It records no undo step: call EditorApi.addUndoStep after the move, as after any other edit. It fails while the engine switches the active history.

Link copied to clipboard
abstract fun movePageSliceOutOfPage(pageSlice: DesignBlock, index: Int, options: MovePageSliceOptions = MovePageSliceOptions()): DesignBlock

Moves a page slice and its content to a new page without page slices. The new page joins the parent of the source page. The id of the page slice becomes invalid. The content keeps its ids. The page slices after it close the gap. An enabled fill of the page slice stays. Otherwise the new page takes the fill of the source page when MovePageSliceOptions.convertSourceToPage acts, and a white fill when it does not. When the move takes the last page slice, the source stays as an empty page without page slices. Conversion keeps the supported appearance keyframes. Tracks of a page slice use the playback clock of its page. Conversion refuses preset animations and other tracks, such as geometry and crop tracks. MovePageSliceOptions.convertSourceToPage refuses a remaining page slice with preset animations or keyframes. Note that the call runs an internal update even when implicit updates are disabled. It records no undo step: call EditorApi.addUndoStep after the move, as after any other edit. It fails while the engine switches the active history.

Link copied to clipboard
abstract fun onClicked(): Flow<DesignBlock>

Subscribe to block click events. Note: DesignBlock is emitted at the end of the engine update if it has been clicked.

Link copied to clipboard
abstract fun onSelectionChanged(): Flow<Unit>

Subscribe to changes in the current set of selected blocks.

Link copied to clipboard
abstract fun onStateChanged(blocks: List<DesignBlock>): Flow<List<DesignBlock>>

Subscribe to changes to the state of a block. Like getState, the state of a block is determined by the state of itself and its Shape, Fill and Effect block(s).

Link copied to clipboard

Checks whether the given block references any text variables. Doesn't check the block's children or its variable bindings.

Link copied to clipboard
abstract fun removeEffect(block: DesignBlock, index: Int)

Removes the effect at the given index. Required scope: "appearance/effect"

Link copied to clipboard
abstract fun removeKeyframes(block: DesignBlock, property: String)

Remove the keyframe track of a block property, so the static value applies again. Does nothing for an animatable property without keyframes. Throws BLOCK.KEYFRAMES_PROPERTY_NOT_ANIMATABLE when the property has no keyframes and isPropertyAnimatable returns false. Required scope: the scopes that setKeyframes needs for the removed track.

Link copied to clipboard
abstract fun removeMask(block: DesignBlock, index: Int)

Removes the mask at the given index. The mask block is not destroyed. Required scope: "layer/clipping"

Link copied to clipboard
abstract fun removeMetadata(block: DesignBlock, key: String)

Remove metadata associated with the key from the given block.

Link copied to clipboard
abstract fun removeModifier(block: DesignBlock, index: Int)

Removes the modifier at the given index from the modifiers of a shape. The modifier is not destroyed. Required scope: "shape/change" on every block that uses the shape.

Link copied to clipboard

Remove the block as duration source block for the page. If a scene or page given set as block, it is deactivated for all blocks in the scene or page.

Link copied to clipboard
abstract fun removeSubshape(block: DesignBlock, index: Int)

Removes the subshape at the given index of a compound shape. The subshape is not destroyed. Required scope: "shape/change"

Link copied to clipboard
abstract fun removeText(block: DesignBlock, from: Int = -1, to: Int = -1)

Removes selected range of text of the given text block. Required scope: "text/edit"

Link copied to clipboard
abstract fun removeTextAnimator(block: DesignBlock, index: Int)

Removes the text animator at the given index from a block. The text animator is not destroyed. Required scope: "appearance/animation"

Link copied to clipboard
abstract fun removeTransition(block: DesignBlock)

Removes the outgoing transition of a clip.

Link copied to clipboard
abstract fun removeVariableBinding(block: DesignBlock, property: String)

Remove the variable binding of a block property. The property keeps its current value. Does nothing if the property is not bound.

Link copied to clipboard
abstract fun replaceText(block: DesignBlock, text: String, from: Int = -1, to: Int = -1)

Inserts the given text into the selected range of the text block. Required scope: "text/edit"

Link copied to clipboard
abstract fun replaceTextWithHTML(block: DesignBlock, html: String, from: Int = -1, to: Int = -1)

Replaces a range of a text block with the text and the formatting of HTML, such as the HTML of a paste. HTML from getTextAsHTML sets every property it carries. Its typeface applies only when a typeface of the scene holds its font file. Otherwise the text keeps the typeface at the cursor, with the weight and style of the source. HTML of another app, such as Google Docs, Word, a web page or an Apple app, sets weight, italic and decorations. It also sets the script style, case, colors, font size, letter spacing, line height, lists and alignment. A CSS px is one pixel of a scene whose font size unit is the pixel. The text takes the first font family of the HTML that a typeface of the asset sources has. Without such a typeface, it keeps the typeface at the cursor. A gray, black or white that covers the largest part of the text is the default color of that app. It is not applied, and the same rule applies to the background color. A pasted paragraph without a list keeps the list of the target paragraph. Without the "text/character" scope, only the text is inserted, with the style at the cursor. Without the "fill/change" scope, or when the text color is bound to a variable, no color is pasted. When the font size or the typeface of the block is bound to a variable, it is not pasted. While the block is being edited and no range is given, the selection is replaced and the cursor moves behind the inserted text. Required scope: "text/edit"

Link copied to clipboard
abstract fun resetCrop(block: DesignBlock)

Resets the manually set crop of the given design block. The block's content fill mode is set to ContentFillMode.COVER. If the block has a fill, the crop values are updated so that it covers the block. Required scope: "layer/crop"

Link copied to clipboard
abstract fun resetInstance(instance: DesignBlock)

Removes all overrides of an instance.

Link copied to clipboard
abstract fun resizeContentAware(blocks: List<DesignBlock>, width: Float, height: Float)

Resize all blocks to the given size. The content of the blocks is automatically adjusted to fit the new dimensions.

Link copied to clipboard
abstract suspend fun saveToArchive(blocks: List<DesignBlock>): ByteBuffer

Saves the given blocks to an archive. Note: All given block handles must be valid, otherwise this call returns an error.

Link copied to clipboard
abstract suspend fun saveToString(blocks: List<DesignBlock>, allowedResourceSchemes: List<String> = listOf("bundle", "file", "http", "https")): String

Saves the given blocks to a proprietary string. If given the root of a block hierarchy, e.g. a page with multiple children, the entire hierarchy is saved. If a resource uri of any block in that hierarchy has a scheme that is not in allowedResourceSchemes, an exception will be thrown. Note: All given block handles must be valid, otherwise an exception will be thrown.

abstract suspend fun saveToString(blocks: List<DesignBlock>, allowedResourceSchemes: List<String> = listOf("bundle", "file", "http", "https"), onDisallowedResourceScheme: suspend (uri: Uri, dataHash: String) -> Uri): String

Saves the given blocks to a proprietary string, as saveToString does, and passes each resource URI whose scheme is not in allowedResourceSchemes to onDisallowedResourceScheme instead of throwing. Note: All given block handles must be valid, otherwise an exception will be thrown.

Link copied to clipboard
abstract fun scale(block: DesignBlock, scale: Float, @FloatRange(from = 0.0, to = 1.0) anchorX: Float, @FloatRange(from = 0.0, to = 1.0) anchorY: Float)

Scales the block and all of its children proportionally around the specified relative anchor point. This updates the position, size and style properties (e.g. stroke width) of the block and its children. With the setting features/implicitUpdatesEnabled off, the call updates only when a block that it reads has no layout yet, as right after an undo. It reads the block, every child of it and each transform parent. That update also lays out every other pending change. Required scope: "layer/resize"

Link copied to clipboard
abstract fun select(block: DesignBlock)

Selects the given block and deselects all other blocks.

Link copied to clipboard
abstract fun sendBackward(block: DesignBlock)

Updates the sorting order of this block and all of its manually created and subjacent siblings so that the given block will have a lower sorting order than the next subjacent sibling. If the block is parented to a track, it is first moved up in the hierarchy. Empty tracks and empty groups are passed by.

Link copied to clipboard
abstract fun sendToBack(block: DesignBlock)

Updates the sorting order of this block and all of its manually created siblings so that the given block has the lowest sorting order. If the block is parented to a track, it is first moved up in the hierarchy.

Link copied to clipboard
abstract fun setAlwaysOnBottom(block: DesignBlock, enabled: Boolean)

Update the block's always-on-bottom property. If true, this blocks's global sorting order is automatically adjusted to be lower than all other siblings without this property. If more than one block is set to be always-on-bottom, the child order decides which is on the bottom. A page slice fails with BLOCK.TYPE_CANNOT_BE_ARRANGED, because its place in the page is its reading order.

Link copied to clipboard
abstract fun setAlwaysOnTop(block: DesignBlock, enabled: Boolean)

Update the block's always-on-top property. If true, this blocks's global sorting order is automatically adjusted to be higher than all other siblings without this property. If more than one block is set to be always-on-top, the child order decides which is on top. A page slice fails with BLOCK.TYPE_CANNOT_BE_ARRANGED, because its place in the page is its reading order.

Link copied to clipboard
abstract fun setAudioFadeIn(block: DesignBlock, duration: Double, easing: AnimationEasingType = AnimationEasingType.LINEAR)

Set an audio fade-in for the given block. The audio ramps up from silence to the block's volume over the given duration at the start of the block.

Link copied to clipboard
abstract fun setAudioFadeOut(block: DesignBlock, duration: Double, easing: AnimationEasingType = AnimationEasingType.LINEAR)

Set an audio fade-out for the given block. The audio ramps down from the block's volume to silence over the given duration at the end of the block.

Link copied to clipboard
abstract fun setBackgroundColor(block: DesignBlock, color: RGBAColor)

Set the background color of the given design block. Required scope: "fill/change"

Link copied to clipboard
abstract fun setBackgroundColorEnabled(block: DesignBlock, enabled: Boolean)

Enable or disable the background of the given design block. Required scope: "fill/change"

Link copied to clipboard
abstract fun setBlendMode(block: DesignBlock, blendMode: BlendMode)

Set the blend mode of the given design block. Required scope: "layer/blendMode"

Link copied to clipboard
abstract fun setBlur(block: DesignBlock, blurBlock: DesignBlock)

Connects block's blur to the given blurBlock. Required scope: "appearance/blur"

Link copied to clipboard
abstract fun setBlurEnabled(block: DesignBlock, enabled: Boolean)

Enable or disable the blur of the given design block.

Link copied to clipboard
abstract fun setBoolean(block: DesignBlock, property: String, value: Boolean)

Set a boolean property of the given design block to the given value.

Link copied to clipboard
abstract fun setClipped(block: DesignBlock, clipped: Boolean)

Update a block's clipped state. A clipped page slice cuts the blocks that it owns at its folds and at the page edges with their bleed. A click beside the page still selects them. Required scope: "layer/clipping"

Link copied to clipboard
abstract fun setColor(block: DesignBlock, property: String, value: Color)

Set a color property of the given design block to the given value.

Link copied to clipboard
abstract fun setComponentProperty(instance: DesignBlock, name: String, value: String)

Sets a published property on an instance as text. This is an override.

Link copied to clipboard

Set the horizontal alignment of the content fill inside the block.

Link copied to clipboard
abstract fun setContentFillMode(block: DesignBlock, mode: ContentFillMode)

Set a block's content fill mode. Required scope: "layer/crop"

Link copied to clipboard

Set the vertical alignment of the content fill inside the block.

Link copied to clipboard
abstract fun setCropAspectRatioLocked(block: DesignBlock, locked: Boolean)

Set whether the crop aspect ratio should be locked for the given block. When enabled, the block will have a FixedAspectRatioTag and crop handles will maintain aspect ratio. When disabled, the FixedAspectRatioTag will be removed and free resizing is allowed. Required scope: "layer/crop"

Link copied to clipboard
abstract fun setCropRotation(block: DesignBlock, rotation: Float)

Set the crop rotation of the given design block. Required scope: "layer/crop"

Link copied to clipboard
abstract fun setCropScaleRatio(block: DesignBlock, scaleRatio: Float)

Set the crop scale ratio of the given design block. This will uniformly scale the content up or down. The center of the scale operation is the center of the crop frame. On a page with a bleed, the ratio and the center of the scale include the bleed. This needs the setting page/imageFillCoversBleed, which is on by default. Required scope: "layer/crop"

Link copied to clipboard
abstract fun setCropScaleX(block: DesignBlock, scaleX: Float)

Set the crop scale in x direction of the given design block. Required scope: "layer/crop"

Link copied to clipboard
abstract fun setCropScaleY(block: DesignBlock, scaleY: Float)

Set the crop scale in y direction of the given design block. Required scope: "layer/crop"

Link copied to clipboard
abstract fun setCropTranslationX(block: DesignBlock, translationX: Float)

Set the crop translation in x direction of the given design block. Required scope: "layer/crop"

Link copied to clipboard
abstract fun setCropTranslationY(block: DesignBlock, translationY: Float)

Set the crop translation in y direction of the given design block. Required scope: "layer/crop"

Link copied to clipboard
abstract fun setDouble(block: DesignBlock, property: String, value: Double)

Set a double property of the given design block to the given value.

Link copied to clipboard
abstract fun setDropShadowBlurRadiusX(block: DesignBlock, blurRadiusX: Float)

Set the drop shadow's blur radius on the x axis of the given design block. Required scope: "appearance/shadow"

Link copied to clipboard
abstract fun setDropShadowBlurRadiusY(block: DesignBlock, blurRadiusY: Float)

Set the drop shadow's blur radius on the y axis of the given design block. Required scope: "appearance/shadow"

Link copied to clipboard
abstract fun setDropShadowClip(block: DesignBlock, clip: Boolean)

Set the drop shadow's clipping of the given design block. (Only applies to shapes.) Required scope: "appearance/shadow"

Link copied to clipboard
abstract fun setDropShadowColor(block: DesignBlock, color: Color)

Set the drop shadow color of the given design block. Required scope: "appearance/shadow"

Link copied to clipboard
abstract fun setDropShadowEnabled(block: DesignBlock, enabled: Boolean)

Enable or disable the drop shadow of the given design block. Required scope: "appearance/shadow"

Link copied to clipboard
abstract fun setDropShadowOffsetX(block: DesignBlock, offsetX: Float)

Set the drop shadow's x offset of the given design block. Required scope: "appearance/shadow"

Link copied to clipboard
abstract fun setDropShadowOffsetY(block: DesignBlock, offsetY: Float)

Set the drop shadow's y offset of the given design block. Required scope: "appearance/shadow"

Link copied to clipboard
abstract fun setDuration(block: DesignBlock, duration: Double)

Set the playback duration of the given block in seconds. The duration defines for how long the block is active in the scene during playback. If a duration is set on the page block, it becomes the duration source block. Note: The duration is ignored when the scene is not in "Video" mode. Note: This also adjusts the trim for non looping blocks. Note: A clip on a track without automatic offsets keeps its transitions. The next clip of each transition moves, with the clips that transitions join after it, until the overlap equals the transition duration again. The overlap is at most half of either clip. With transition/overlap disabled, or with a group clip on either side, the clips meet at the cut.

Link copied to clipboard
abstract fun setEffectEnabled(effectBlock: DesignBlock, enabled: Boolean)

Sets the enabled state of an effect block.

Link copied to clipboard
abstract fun setEffectSource(effectBlock: DesignBlock, source: DesignBlock?)

Set the block that an effect block reads, such as the map of a displacement map effect. The source still draws on its own. It is read without its position and rotation, and also when it is hidden. Required scope: "appearance/effect" on every block the effect is attached to.

Link copied to clipboard
abstract fun setEnum(block: DesignBlock, property: String, value: String)

Set an enum property of the given design block to the given value. Setting scene/mode to Video fails with BLOCK.PAGE_SLICE_IN_VIDEO_SCENE when the scene holds a page slice.

Link copied to clipboard
abstract fun setFill(block: DesignBlock, fill: DesignBlock)

Sets the block containing the fill properties of the given block. On a page slice, the call also enables the fill, because a new page slice has its fill disabled. Note: The previous fill block is not destroyed automatically. Required scopes: "fill/change", "fill/changeType"

Link copied to clipboard
abstract fun setFillEnabled(block: DesignBlock, enabled: Boolean)

Enable or disable the fill of the given design block. Required scope: "fill/change"

Link copied to clipboard
abstract fun setFillOverprint(block: DesignBlock, overprint: Boolean)

Mark the fill of the given design block as overprint for PDF export.

Link copied to clipboard
abstract fun setFillSolidColor(block: DesignBlock, color: RGBAColor)

Set the fill color of the given design block. Required scope: "fill/change"

Link copied to clipboard
abstract fun setFlipHorizontal(block: DesignBlock, flip: Boolean)

Update a block's horizontal flip. With the setting features/implicitUpdatesEnabled off, the call updates only when a block that it reads has no layout yet, as right after an undo. It reads the block, the members of a group and each transform parent. That update also lays out every other pending change. The block is mirrored around the center of its frame, so its rendered bounds do not move. For a block without rotation, anchor or skew, turning the flip on moves getPositionX and getFrameX to the visual right edge (x + width). Turning it off moves them back. getGlobalBoundingBoxX stays the same. Required scope: "layer/flip"

Link copied to clipboard
abstract fun setFlipVertical(block: DesignBlock, flip: Boolean)

Update a block's vertical flip. With the setting features/implicitUpdatesEnabled off, the call updates only when a block that it reads has no layout yet, as right after an undo. It reads the block, the members of a group and each transform parent. That update also lays out every other pending change. The block is mirrored around the center of its frame, so its rendered bounds do not move. For a block without rotation, anchor or skew, turning the flip on moves getPositionY and getFrameY to the visual bottom edge (y + height). Turning it off moves them back. getGlobalBoundingBoxY stays the same. Required scope: "layer/flip"

Link copied to clipboard
abstract fun setFloat(block: DesignBlock, property: String, value: Float)

Set a float property of the given design block to the given value.

Link copied to clipboard
abstract fun setFont(block: DesignBlock, fontFileUri: Uri, typeface: Typeface)

Sets the given font and typeface for the text block. Existing formatting is reset. Required scope: "text/character"

Link copied to clipboard
abstract fun setFontRequest(block: DesignBlock, request: FontRequest, from: Int = -1, to: Int = -1)

Stores a runtime font request for this block or text range and starts resolution. The request is preserved through load/save even when unavailable. Existing URI font APIs retain their behavior. Resolution is asynchronous. Await forceLoadResources before measuring or exporting. Substitution can change layout; metric-compatible substitution is not provided. Required scope: "text/character".

Link copied to clipboard
abstract fun setGradientColorStops(block: DesignBlock, property: String, colorStops: List<GradientColorStop>)

Set a gradient color stops property of the given design block.

Link copied to clipboard
abstract fun setHeight(block: DesignBlock, value: Float, maintainCrop: Boolean = false)

Update a block's height and optionally maintain the crop. A new height of a page with page slices goes to every page slice on a horizontal axis. On a vertical axis, it goes to the last page slice. A page slice that this shrinks stops at 25 pixels at the DPI of the scene. So the page can end up higher than asked. A height of 0 or less on a page slice fails with BLOCK.PAGE_SLICE_SIZE_INVALID. If the crop is maintained, the crop values will be automatically adjusted. The content fill mode Cover is only kept if the features/transformEditsRetainCoverMode setting is enabled, otherwise it will change to Crop. If the size of a group is changed, both dimensions are modified and the aspect ratio of the group is kept. Required scope: "layer/resize"

Link copied to clipboard
abstract fun setHeightMode(block: DesignBlock, mode: SizeMode)

Set a block's mode for its height. A switch between Absolute and Percent keeps the stored height and reads it in the new mode. Set the height after the mode, without maintainCrop: otherwise the crop is adjusted from the size that the old number has in the new mode. Required scope: "layer/resize"

Link copied to clipboard
abstract fun setInAnimation(block: DesignBlock, animation: DesignBlock)

Sets the "in" animation for the given block.

Link copied to clipboard
abstract fun setIncludedInExport(block: DesignBlock, enabled: Boolean)

Set if you want the given design block to be included in exported result.

Link copied to clipboard
abstract fun setInstanceVariant(instance: DesignBlock, name: String, value: String)

Switches an instance to the variant with this property value. Overrides stay, and layers match by name.

Link copied to clipboard
abstract fun setInt(block: DesignBlock, property: String, value: Int)

Set an int property of the given design block to the given value.

Link copied to clipboard
abstract fun setKeyframes(block: DesignBlock, property: String, keyframes: List<Keyframe>, mode: TrackMode = TrackMode.ABSOLUTE)

Replace the keyframe track of a block property. Keyframe times are normalized over the duration of the block, from 0 to 1. The engine sorts the keyframes by time. Setting the static value of the property does not change its keyframes. The keyframes belong to the block that owns the property. Replacing a fill, shape or effect does not move them to the new block. Scaling the block or changing the design unit also converts the keyframes of length and position properties, such as corner radii and position. Rotating or flipping the block turns or mirrors the keyframes of its position, rotation and skew with it. A group's keyframes turn with the group. A turn other than a half turn joins position/x and position/y tracks into one position track. They must share the mode, the times and the easings, and no position track may exist. Other axis tracks cannot turn: their Absolute values move with the block, and their Relative values stay. A rotation track turns a graphic or text without an anchor around its frame center, as setRotation does. With transform/anchor/x or transform/anchor/y set, even to 0, it turns around the anchor. The vec2 properties position (a block) and shape/position (a shape) animate the /x and /y properties together. Their spatialOut and spatialIn tangents curve the motion path. getVec2 and setVec2 read and write their static value. A position/x or position/y track overrides that axis of a position track. Position keyframes are in design units, also when the position mode is PositionMode.PERCENT. Required scope: "appearance/animation" and the scope that the setter of the property needs, such as "layer/move" for position or "layer/rotate" for rotation. A transform/scale/x or transform/scale/y keyframe that shows a scale with another sign than the static scale also needs "layer/flip".

Link copied to clipboard
abstract fun setKind(block: DesignBlock, kind: String)

Set the kind of the given block, fails if the block is invalid.

Link copied to clipboard
abstract fun setLoopAnimation(block: DesignBlock, animation: DesignBlock)

Sets the "loop" animation for the given block.

Link copied to clipboard
abstract fun setLooping(block: DesignBlock, looping: Boolean)

Set whether the block should start from the beginning again or stop.

Link copied to clipboard
abstract fun setMatte(block: DesignBlock, source: DesignBlock?, mode: MatteMode = MatteMode.ALPHA)

Mask a block with the rendered alpha or luminance of another block, like a track matte. A block used as a matte source is not drawn on its own. If the source draws nothing, for example because it is hidden or outside its time range, an alpha or luma matte hides the block and an inverted matte shows it whole. SVG export does not apply mattes, so a matted block exports whole. Required scope: "layer/clipping" on the block, and "layer/visibility" on the source, which stops drawing on its own.

Link copied to clipboard
abstract fun setMetadata(block: DesignBlock, key: String, value: String)

Set a metadata value of a block identified by a key. If the key does not exist, yet, it will be added.

Link copied to clipboard
abstract fun setMuted(block: DesignBlock, muted: Boolean)

Set whether the audio of the block is muted.

Link copied to clipboard
abstract fun setName(block: DesignBlock, name: String)

Update a block's name.

Link copied to clipboard
abstract fun setNativePixelBuffer(pixelStreamFill: DesignBlock, width: Int, height: Int): Int

Update the pixels of the given pixelStreamFill block. This method should be called in order to bind a new android.graphics.SurfaceTexture to the pixelStreamFill, as well as after every android.graphics.SurfaceTexture.updateTexImage invocation. Note that the native texture is created only once: all subsequent calls on the same pixel stream fill will return the same id.

Link copied to clipboard
abstract fun setOpacity(block: DesignBlock, @FloatRange(from = 0.0, to = 1.0) value: Float)

Set the opacity of the given design block. Required scope: "layer/opacity"

Link copied to clipboard
abstract fun setOutAnimation(block: DesignBlock, animation: DesignBlock)

Sets the "out" animation for the given block.

Link copied to clipboard
abstract fun setPageDurationSource(page: DesignBlock, block: DesignBlock)

Set a block as duration source so that the overall page duration is automatically determined by this. If no defining block is set, the page duration is calculated over all children. Only one block per page can be marked as duration source. Will automatically unmark the previously marked.

Link copied to clipboard
abstract fun setPlaceholderBehaviorEnabled(block: DesignBlock, enabled: Boolean)

Enable or disable the placeholder behavior for a block.

Link copied to clipboard

Enable or disable the visibility of the placeholder button for a block.

Link copied to clipboard

Enable or disable the visibility of the placeholder overlay pattern for a block.

Link copied to clipboard
abstract fun setPlaceholderEnabled(block: DesignBlock, enabled: Boolean)

Enable or disable the placeholder function for a block.

Link copied to clipboard
abstract fun setPlaybackSpeed(block: DesignBlock, speed: Float)

Sets the playback speed multiplier of a block that supports playback control. Note: This also adjusts the trim and duration of the block. Video fills running faster than 3.0x are force muted until reduced to 3.0x or below. An audio block that createAudioFromVideo extracts from a video faster than 3.0x keeps that speed and is force muted too. This function still rejects a speed above 3.0x for it. On a group, the speed changes no duration and acts only when group/composition is true: the children then run that many times faster. A clip whose duration this changes keeps its transitions, as with setDuration.

Link copied to clipboard
abstract fun setPlaybackTime(block: DesignBlock, time: Double)

Set the playback time of the given block.

Link copied to clipboard
abstract fun setPlaying(block: DesignBlock, enabled: Boolean)

Set whether the block should be during active playback. Note that playing a page switches the editor to the Playback edit mode. From 0.2 s after the start, a change to the position, size, rotation, fill or text of a content block ends that mode. So does a change to the opacity, adjustments, shape or volume of any block, the page included. The editor returns to the Transform edit mode, which stops the playback. While a page plays, only a change on that page counts. A change to a block on another page, or to a block that is not in the scene, keeps the playback running.

Link copied to clipboard
abstract fun setPositionX(block: DesignBlock, value: Float)

Update a block's x position. The position refers to the block's local space, relative to its parent with the origin at the top left. A page slice takes its position from its page, so the call fails with BLOCK.POSITION_PARENT_CONTROLLED on one. Required scope: "layer/move"

Link copied to clipboard
abstract fun setPositionXMode(block: DesignBlock, mode: PositionMode)

Set a block's mode for its x position. The position refers to the block's local space, relative to its parent with the origin at the top left. Required scope: "layer/move"

Link copied to clipboard
abstract fun setPositionY(block: DesignBlock, value: Float)

Update a block's y position. The position refers to the block's local space, relative to its parent with the origin at the top left. A page slice takes its position from its page, so the call fails with BLOCK.POSITION_PARENT_CONTROLLED on one. Required scope: "layer/move"

Link copied to clipboard
abstract fun setPositionYMode(block: DesignBlock, mode: PositionMode)

Set a block's mode for its y position. The position refers to the block's local space, relative to its parent with the origin at the top left. Required scope: "layer/move"

Link copied to clipboard
abstract fun setRotation(block: DesignBlock, radians: Float)

Update a block's rotation. With the setting features/implicitUpdatesEnabled off, the call updates only when a block that it reads has no layout yet, as right after an undo. It reads the block, the members of a group and each transform parent. That update also lays out every other pending change. Required scope: "layer/rotate"

Link copied to clipboard
abstract fun setScopeEnabled(block: DesignBlock, key: String, enabled: Boolean)

Enable or disable a scope for a given block.

Link copied to clipboard
abstract fun setSelected(block: DesignBlock, selected: Boolean)

Update the selection state of a block. Fails for invalid blocks. Note: Previously selected blocks remain selected. A page slice and its page are never selected together: selecting one deselects the other. Required scope: "editor/select"

Link copied to clipboard
abstract fun setShape(block: DesignBlock, shape: DesignBlock)

Sets the block containing the shape properties of the given block. Note: The previous shape block is not destroyed automatically. A page with page slices takes only a rect shape. Required scope: "shape/change"

Link copied to clipboard
abstract fun setSoloPlaybackEnabled(block: DesignBlock, enabled: Boolean)

Set whether the given block or fill should play its contents while the rest of the scene remains paused. Note: Setting this to true for one block will automatically set it to false on all other blocks.

Link copied to clipboard
abstract fun setSourceSet(block: DesignBlock, property: String, sourceSet: List<Source>)

Set the source set of a source set property of the given block. The crop and content fill mode of the associated block will be set to the default values.

Link copied to clipboard
abstract fun setSpotColorForCutoutType(type: CutoutType, name: String)

Set the spot color assign to a cutout type. If no spot color is set, type CutoutType.SOLID is assigned "CutContour" and type CutoutType.DASHED is assigned "PerfCutContour". All cutout blocks of the given type will be immediately assigned that spot color.

Link copied to clipboard
abstract fun setState(block: DesignBlock, state: BlockState)

Set the state of a block. While an image fill is pending, the engine adds no automatic source set entries to it.

Link copied to clipboard
abstract fun setString(block: DesignBlock, property: String, value: String)

Set a string property of the given design block to the given value.

Link copied to clipboard
abstract fun setStrokeColor(block: DesignBlock, color: Color)

Set the stroke color of the given design block. Required scope: "stroke/change"

Link copied to clipboard

Set the stroke corner geometry of the given design block. Required scope: "stroke/change"

Link copied to clipboard
abstract fun setStrokeDashArray(block: DesignBlock, dashArray: List<Float>)

Set a custom dash pattern for the given design block's stroke. Semantics match SVG's stroke-dasharray: alternating on/off lengths in design-unit space. When the pattern is non-empty it overrides the preset implied by StrokeStyle. Pass an empty list to fall back to the preset. Required scope: "stroke/change"

Link copied to clipboard
abstract fun setStrokeDashEndCap(block: DesignBlock, cap: StrokeCap)

Set the cap geometry at the trailing edge of each dash piece (excluding the line's actual end). Only takes effect when a dash pattern is active. Distinct from setStrokeEndCap, which only applies to the end of the open path itself.

Link copied to clipboard
abstract fun setStrokeDashOffset(block: DesignBlock, dashOffset: Float)

Set the dash offset of the given design block's stroke. Semantics match SVG's stroke-dashoffset. Ignored when the custom dash pattern is empty. Required scope: "stroke/change"

Link copied to clipboard
abstract fun setStrokeDashStartCap(block: DesignBlock, cap: StrokeCap)

Set the cap geometry at the leading edge of each dash piece (excluding the line's actual start). Only takes effect when a dash pattern is active. Distinct from setStrokeStartCap, which only applies to the start of the open path itself.

Link copied to clipboard
abstract fun setStrokeEnabled(block: DesignBlock, enabled: Boolean)

Enable or disable the stroke of the given design block. Required scope: "stroke/change"

Link copied to clipboard
abstract fun setStrokeEndCap(block: DesignBlock, cap: StrokeCap)

Set the cap geometry at the end of an open stroked path.

Link copied to clipboard
abstract fun setStrokeFill(block: DesignBlock, fill: DesignBlock?)

Paints the stroke of the given block with a fill block, for example a gradient, instead of the stroke color. Color, gradient, stripe and image fills are supported; video and pixel stream fills are rejected. An image covers the frame of the block and the part of the stroke outside it. The crop, the effects and the blur of the block apply only to its fill. Note: The previous stroke fill block is not destroyed automatically. The fill block may not be the block's own fill. A stroke color with alpha 0 still hides the stroke; the fill's own colors set the opacity otherwise. Required scope: "stroke/change"

Link copied to clipboard
abstract fun setStrokeOverprint(block: DesignBlock, overprint: Boolean)

Mark the stroke of the given design block as overprint for PDF export.

Link copied to clipboard
abstract fun setStrokePosition(block: DesignBlock, position: StrokePosition)

Set the stroke position of the given design block. Required scope: "stroke/change"

Link copied to clipboard
abstract fun setStrokeStartCap(block: DesignBlock, cap: StrokeCap)

Set the cap geometry at the start of an open stroked path. Pair with both-ends shortcut.

Link copied to clipboard
abstract fun setStrokeStyle(block: DesignBlock, style: StrokeStyle)

Set the stroke style of the given design block. Required scope: "stroke/change"

Link copied to clipboard
abstract fun setStrokeWidth(block: DesignBlock, width: Float)

Set the stroke width of the given design block. When the dash pattern is a preset's pattern at the old width, it is scaled to the new width. Any other dash pattern keeps its lengths. Required scope: "stroke/change"

Link copied to clipboard
abstract fun setTextBackgroundColor(block: DesignBlock, color: Color, from: Int = -1, to: Int = -1)

Changes the background color of the text in the selected range to the given color. The background is drawn as a rectangle behind each affected text run, or as a band along the curve for text on a path. A fully transparent color removes the background from the range. The run background is independent of the block-level background color ("backgroundColor/color"); it is drawn on top of the block-level background. Required scope: "fill/change"

Link copied to clipboard
abstract fun setTextBaselineShift(block: DesignBlock, baselineShift: Float, from: Int = -1, to: Int = -1)

Sets the baseline shift for a grapheme range. Moves the glyphs of the range up from the baseline, or down for a negative value. The line height does not change. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextCase(block: DesignBlock, textCase: TextCase, from: Int = -1, to: Int = -1)

Sets the given text case for the selected range of text. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextColor(block: DesignBlock, color: Color, from: Int = -1, to: Int = -1)

Changes the color of the text in the selected range to the given color. Required scope: "fill/change"

Link copied to clipboard
abstract fun setTextCursorRange(range: IntRange)

Sets the text cursor range (selection) within the text block that is currently being edited. If from equals to, the cursor is positioned at that index.

Link copied to clipboard
abstract fun setTextDecoration(block: DesignBlock, config: TextDecorationConfig, from: Int = -1, to: Int = -1)

Sets the text decoration for the selected range of text. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextFontSize(block: DesignBlock, fontSize: Float, from: Int = -1, to: Int = -1)

Changes the size of the text in the selected range to the given size. If the font size is applied to the entire text block, its font size property will be updated. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextFontStyle(block: DesignBlock, fontStyle: FontStyle, from: Int = -1, to: Int = -1)

Changes the style of the text in the selected range to the given style. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextFontWeight(block: DesignBlock, fontWeight: FontWeight, from: Int = -1, to: Int = -1)

Changes the weight of the text in the selected range to the given weight. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextFontWeightAndStyle(block: DesignBlock, fontWeight: FontWeight, fontStyle: FontStyle, from: Int = -1, to: Int = -1)

Changes the weight and the style of the text in the selected range in one step. Each run gets the font of its typeface with exactly this weight and style. Separate calls to setTextFontWeight and setTextFontStyle pass through a face in between, so they fail when the typeface lacks that face. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextHorizontalAlignment(block: DesignBlock, alignment: HorizontalAlignment?, paragraphIndex: Int = -1)

Sets the paragraph-level horizontal alignment override for one or all paragraphs of a text block. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextKerning(block: DesignBlock, kerning: Float, from: Int = -1, to: Int = -1)

Sets kerning for a grapheme range.

Link copied to clipboard
abstract fun setTextLineHeight(block: DesignBlock, lineHeight: Float?, paragraphIndex: Int = -1)

Sets the line height multiplier for a specific paragraph or all paragraphs of a text block. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextListLevel(block: DesignBlock, listLevel: Int, paragraphIndex: Int = -1)

Sets the list nesting level for a specific paragraph or all paragraphs of a text block. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextListStyle(block: DesignBlock, listStyle: ListStyle, paragraphIndex: Int = -1, listLevel: Int? = null)

Sets the list style for a specific paragraph or all paragraphs of a text block. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextOnPath(block: DesignBlock, svgPath: String?)

Sets or clears the SVG path that defines a text block's baseline.

Link copied to clipboard
abstract fun setTextOnPathFlipped(block: DesignBlock, flipped: Boolean)

Sets whether text is placed on the opposite side of the baseline path.

Link copied to clipboard
abstract fun setTextOnPathOffset(block: DesignBlock, offset: Float)

Sets the start offset along the baseline path as a proportion of the path length.

Link copied to clipboard
abstract fun setTextOpenTypeFeatures(block: DesignBlock, features: List<OpenTypeFeature>, from: Int = -1, to: Int = -1)

Sets the OpenType features of a grapheme range, such as tnum for digits of equal width.

Link copied to clipboard
abstract fun setTextScriptStyle(block: DesignBlock, scriptStyle: ScriptStyle, from: Int = -1, to: Int = -1)

Sets the given script style for the selected range of text. Superscript and subscript text is scaled down and shifted off the regular baseline. The block properties "text/superscriptFontScale", "text/superscriptVerticalShift", "text/subscriptFontScale" and "text/subscriptVerticalShift" adjust the scale and shift. Required scope: "text/character"

Link copied to clipboard
abstract fun setTextVariationAxes(block: DesignBlock, axes: List<VariationAxisValue>, from: Int = -1, to: Int = -1)

Sets the variation axis values of a grapheme range, such as wdth for the width of a variable font.

Link copied to clipboard
abstract fun setTimeOffset(block: DesignBlock, offset: Double)

Set the time offset of the given block relative to its parent. The time offset controls when the block is first active in the timeline. Note: The time offset is not supported by the page block.

Link copied to clipboard
abstract fun setTransformLocked(block: DesignBlock, locked: Boolean)

Update a block's transform locked state.

Link copied to clipboard
abstract fun setTransformParent(block: DesignBlock, parent: DesignBlock?)

Makes a block follow the transform of another block, or stops it from following one. The block's position, rotation and scale are then read in the local space of the transform parent, so the block moves with it. The block does not keep its place on screen when the link changes. Only the transform is inherited: opacity, visibility and the stacking order still come from the block's own parent. A hidden block can be a transform parent. When the transform parent is destroyed, the block stops following it. A block whose transform is locked can neither get nor lose a link. Required scope: "layer/move"

Link copied to clipboard
abstract fun setTransition(block: DesignBlock, transition: DesignBlock)

Assigns the outgoing transition of a clip.

Link copied to clipboard
abstract fun setTrimLength(block: DesignBlock, length: Double)

Set the trim length of the given block or fill. The trim length is the duration of the audio or video clip that should be used for playback. Note: After reaching this value during playback, the trim region will loop. Note: This requires the video or audio clip to be loaded. Note: A clip whose duration this changes keeps its transitions, as with setDuration.

Link copied to clipboard
abstract fun setTrimOffset(block: DesignBlock, offset: Double)

Set the trim offset of the given block or fill. Sets the time in seconds within the fill at which playback of the audio or video clip should begin. Note: This requires the video or audio clip to be loaded.

Link copied to clipboard
abstract fun setTypeface(block: DesignBlock, typeface: Typeface, from: Int = -1, to: Int = -1)

Sets the given typeface for the text block. The current formatting, e.g., bold or italic, is retained as far as possible. Some formatting might change if the new typeface does not support it, e.g. thin might change to light, bold to normal, and/or italic to non-italic. If the typeface is applied to the entire text block, its typeface property will be updated. If a run does not support the new typeface, it will fall back to the default typeface from the typeface property. Required scope: "text/character"

Link copied to clipboard
abstract fun setUri(block: DesignBlock, property: String, value: Uri)

Set a uri property of the given design block to the given value.

Link copied to clipboard
abstract fun setVariableBinding(block: DesignBlock, property: String, key: String)

Bind a block property to a color, number, image or typeface variable, and apply the variable's current value. Color variables bind to color properties and number variables to float properties. Image variables bind only to "fill/image/imageFileURI", "fill/image/previewFileURI" and "fill/video/fileURI". Typeface variables bind only to "text/typeface" and "caption/typeface". A direct write to a bound property fails with BLOCK.PROPERTY_BOUND until the binding is removed. A bound typeface also locks setTypeface and setFont. On a text block, a variable bound to "fill/solid/color" or the font size sets every run of the text, and setTextColor or setTextFontSize fails for any range. Keyframes, undo and scene loads still change it. Changing the design unit converts a bound length. A number variable whose bound properties all hold its value converts with them. Otherwise the variable keeps its value, and the next variable write sets the lengths in the new unit.

Link copied to clipboard
abstract fun setVariantProperty(component: DesignBlock, name: String, value: String)

Sets the value of a variant property on a main component.

Link copied to clipboard
abstract fun setVec2(block: DesignBlock, property: String, value: Vector2)

Set a vec2 property of the given design block to the given value. position sets position/x and position/y, and shape/position sets shape/position/x and shape/position/y, with the checks of those properties. Either both components change or neither does.

Link copied to clipboard
abstract fun setVisible(block: DesignBlock, visible: Boolean)

Update a block's visibility. A hidden page slice hides the blocks that it owns, as a hidden parent hides its children. They show in no canvas and no export, and take no hit. It keeps its room in the page. The blocks keep their own visibility. Required scope: "layer/visibility"

Link copied to clipboard
abstract fun setVolume(block: DesignBlock, @FloatRange(from = 0.0, to = 1.0) volume: Float)

Set the audio volume of the given block.

Link copied to clipboard
abstract fun setWidth(block: DesignBlock, value: Float, maintainCrop: Boolean = false)

Update a block's width and optionally maintain the crop. A new width of a page with page slices goes to its last page slice on a horizontal axis. On a vertical axis, it goes to every page slice. A page slice that this shrinks stops at 25 pixels at the DPI of the scene. So the page can end up wider than asked. A width of 0 or less on a page slice fails with BLOCK.PAGE_SLICE_SIZE_INVALID. If the crop is maintained, the crop values will be automatically adjusted. The content fill mode Cover is only kept if the features/transformEditsRetainCoverMode setting is enabled, otherwise it will change to Crop. If the size of a group is changed, both dimensions are modified and the aspect ratio of the group is kept. Required scope: "layer/resize"

Link copied to clipboard
abstract fun setWidthMode(block: DesignBlock, mode: SizeMode)

Set a block's mode for its width. A switch between Absolute and Percent keeps the stored width and reads it in the new mode. Set the width after the mode, without maintainCrop: otherwise the crop is adjusted from the size that the old number has in the new mode. Required scope: "layer/resize"

Link copied to clipboard
abstract fun split(block: DesignBlock, atTime: Double, options: SplitOptions = SplitOptions()): DesignBlock

Split a block at the specified time. The original block will be trimmed to end at the split time, and the returned duplicate will start at the split time and continue to the original end time.

Link copied to clipboard
abstract fun supportsAnimation(block: DesignBlock): Boolean

Returns whether the block supports animation.

Link copied to clipboard

Query if the given block has background color properties.

Link copied to clipboard
abstract fun supportsBlendMode(block: DesignBlock): Boolean

Query if the given block has a blend mode.

Link copied to clipboard
abstract fun supportsBlur(block: DesignBlock): Boolean

Checks whether the block supports blur.

Link copied to clipboard

Query if the given block has a content fill mode.

Link copied to clipboard
abstract fun supportsCrop(block: DesignBlock): Boolean

Query if the given block has crop properties.

Link copied to clipboard
abstract fun supportsDropShadow(block: DesignBlock): Boolean

Query if the given block has a drop shadow property.

Link copied to clipboard
abstract fun supportsDuration(block: DesignBlock): Boolean

Returns whether the block has a duration property.

Link copied to clipboard
abstract fun supportsEffects(block: DesignBlock): Boolean

Queries whether the block supports effects.

Link copied to clipboard
abstract fun supportsFill(block: DesignBlock): Boolean

Query if the given block has fill color properties.

Link copied to clipboard
abstract fun supportsMasks(block: DesignBlock): Boolean

Checks whether the block supports masks. Graphic, text and group blocks do.

Link copied to clipboard
abstract fun supportsModifiers(block: DesignBlock): Boolean

Queries whether the block supports modifiers. Every shape block does.

Link copied to clipboard
abstract fun supportsOpacity(block: DesignBlock): Boolean

Query if the given block has an opacity.

Link copied to clipboard

Returns whether the block can be marked as the element that defines the duration of the given page.

Link copied to clipboard

Query whether the block supports placeholder behavior.

Link copied to clipboard

Checks whether the block supports placeholder controls.

Link copied to clipboard

Returns whether the block supports a playback control.

Link copied to clipboard

Returns whether the block has a playback time property.

Link copied to clipboard
abstract fun supportsShape(block: DesignBlock): Boolean

Query if the given block has a shape property.

Link copied to clipboard
abstract fun supportsStroke(block: DesignBlock): Boolean

Query if the given block has a stroke property.

Link copied to clipboard

Queries whether the block supports text animators. Text and caption blocks do.

Link copied to clipboard
abstract fun supportsTimeOffset(block: DesignBlock): Boolean

Returns whether the block has a time offset property.

Link copied to clipboard
abstract fun supportsTransition(block: DesignBlock): Boolean

Checks whether a clip can own an outgoing clip-to-clip transition.

Link copied to clipboard
abstract fun supportsTrim(block: DesignBlock): Boolean

Returns whether the block has trim properties.

Link copied to clipboard
abstract fun toggleBoldFont(block: DesignBlock, from: Int = -1, to: Int = -1)

Toggles the font weight of the given block between bold and normal. Required scope: "text/character"

Link copied to clipboard
abstract fun toggleItalicFont(block: DesignBlock, from: Int = -1, to: Int = -1)

Toggles the font style of the given block between italic and normal. Required scope: "text/character"

Link copied to clipboard
abstract fun toggleTextDecorationOverline(block: DesignBlock, from: Int = -1, to: Int = -1)

Toggles the text decoration overline of the given block. Required scope: "text/character"

Link copied to clipboard
abstract fun toggleTextDecorationStrikethrough(block: DesignBlock, from: Int = -1, to: Int = -1)

Toggles the text decoration strikethrough of the given block. Required scope: "text/character"

Link copied to clipboard
abstract fun toggleTextDecorationUnderline(block: DesignBlock, from: Int = -1, to: Int = -1)

Toggles the text decoration underline of the given block. Required scope: "text/character"

Link copied to clipboard
abstract fun ungroup(block: DesignBlock)

Ungroups a group.